<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>福小兵</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: url('back.jpg') no-repeat center center fixed;
            background-size: cover;
            color: #333;
            text-align: center;
            margin: 0;
            padding: 0;
        }
        nav {
            background-color: rgba(76, 175, 80, 0.8);
            padding: 10px;
            position: fixed;
            width: 100%;
            top: 0;
            left: 0;
            z-index: 1000;
        }
        nav a {
            color: white;
            text-decoration: none;
            margin: 0 15px;
            font-size: 1.2em;
            padding: 10px 20px;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }
        nav a:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }
        h1 {
            margin-top: 80px;
            font-size: 2.5em;
            color: #4CAF50;
        }
        #wordcloud-container {
            max-width: 60%;
            margin: 20px auto;
            display: block;
            border: 2px solid #4CAF50;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            border-radius: 10px;
            overflow: hidden;
            position: relative;
            background-color: rgba(255, 255, 255, 0.8);
        }
        #wordcloud {
            width: 100%;
            transition: transform 0.3s ease-in-out;
        }
        #wordcloud:hover {
            transform: scale(1.1);
        }
        #notification {
            display: none;
            position: fixed;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(76, 175, 80, 0.5); /* Adjusted transparency */
            color: white;
            padding: 10px 20px;
            border-radius: 5px;
            z-index: 1001;
            font-size: 1em;
        }
        footer {
            display: none;
        }
    </style>
</head>
<body>
    <nav>
        <a href="#home">首页</a>
        <a href="#about">关于</a>
        <a href="#contact">联系</a>
    </nav>
    <h1>福小兵</h1>
    <div id="wordcloud-container">
        <img id="wordcloud" src="http://localhost:5000/wordcloud" alt="Word Cloud">
    </div>
    <div id="notification">30s更新一次词云图</div>

    <script>
        function refreshWordcloud() {
            const wordcloud = document.getElementById('wordcloud');
            wordcloud.classList.remove('visible');
            setTimeout(() => {
                wordcloud.src = 'http://localhost:5000/wordcloud?' + new Date().getTime();
                wordcloud.classList.add('visible');
            }, 1000);
        }

        function showNotification() {
            const notification = document.getElementById('notification');
            notification.style.display = 'block';
            setTimeout(() => {
                notification.style.display = 'none';
            }, 3000);
        }

        setInterval(refreshWordcloud, 30000);

        window.onload = () => {
            const wordcloud = document.getElementById('wordcloud');
            wordcloud.classList.add('visible');
        };

        document.getElementById('wordcloud').addEventListener('dblclick', showNotification);
    </script>
</body>
</html>